// Lee tip 1.0 http://www.xij.cn/blog/?p=68

var tipFirst=true;
function tip(title,content,width,height,cssName){
//http://www.pqshow.com/design/htmlcss/200909/9866.html
if(tipFirst==true){
  var temp_pos=new String;
  temp_pos="<div id=\"posBoxBg\" style=\"height:"+$j(document).height()+"px;filter:alpha(opacity=0);opacity:0;\"></div>";
  temp_pos+="<div id=\"posBox\" class=\"posBox\">";
  temp_pos+="<div class=\"close\"><span></span></div>";
  temp_pos+="<div class=\"content\"></div>";
  temp_pos+="</div>";
  $j("body").append(temp_pos);
  tipFirst=false;
}

$j("#posBox .close span").click(function(){
  $j("#posBoxBg").animate({opacity:"0"},"normal",function(){$j(this).hide();});
  $j("#posBox").animate({top:($j(document).scrollTop()-(height=="auto"?300:parseInt(height)))+"px"},"normal",function(){$j(this).hide();});
});

$j("#posBox .title h4").html(title);
contentType=content.substring(0,content.indexOf(":"));
content=content.substring(content.indexOf(":")+1,content.length);
switch(contentType){
  case "url":
  var content_array=content.split("?");
  $j("#posBox .content").ajaxStart(function(){
    $j(this).html("loading...");
  });
  $j.ajax({
    type:content_array[0],
    url:content_array[1],
    data:content_array[2],
	error:function(){
	  $j("#posBox .content").html("error...");
	},
    success:function(html){
      $j("#posBox .content").html(html);
    }
  });
  break;
  case "text":
  $j("#posBox .content").html(content);
  break;
  case "id":
  $j("#posBox .content").html($j("#"+content+"").html());
  break;
  case "iframe":
  $j("#posBox .content").html("<iframe src=\""+content+"\" width=\"100%\" height=\""+(parseInt(height)-30)+"px"+"\" scrolling=\"auto\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\"></iframe>");
}
$j("#posBoxBg").append("<iframe src='' style=\"position:absolute; visibility:inherit; top:0px; left:0px; width:100%;height:100%; z-index:-1; filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';\">");
$j("#posBoxBg").show();
$j("#posBoxBg").animate({opacity:"0.5"},"normal");
$j("#posBox").attr("class","posBox "+cssName);
$j("#posBox").css({display:"block",left:(($j(document).width())/2-(parseInt(width)/2))+"px",top:($j(document).scrollTop()-(height=="auto"?300:parseInt(height)))+"px",width:width,height:height});
$j("#posBox").animate({top:($j(document).scrollTop()+200)+"px"},"normal");
}